package com.chefu.order.config;

import com.chefu.common.utils.IdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 初始化分布式id对象
 */
@Configuration
public class IdWorkerConfig {

    @Bean
    public IdWorker idWorker(IdWorkerProperties idWorkerProps){
        return new IdWorker(idWorkerProps.getWorkerId(),idWorkerProps.getDataCenterId());
    }
}
